﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using DLV.Utilities;

namespace DLV.Data.Entities
{
    public class VisaController
    {
        public int InsertVisa(VisaInfo info)
        {
            return SQL.InsertVisa(info.PartnerId, info.VisaName, info.SortDescription, info.DetailDescription, info.CreatedBy, info.CreatedDate, info.UpdatedBy, info.UpdatedDate, info.Status, info.NationalId);
        }
        public void UpdateVisa(VisaInfo info)
        {
            SQL.UpdateVisa(info.VisaId, info.PartnerId, info.VisaName, info.SortDescription, info.DetailDescription, info.CreatedBy, info.CreatedDate, info.UpdatedBy, info.UpdatedDate, info.Status, info.NationalId);
        }
        public void DeleteVisa(VisaInfo info)
        {
            DeleteVisa(info.VisaId);
        }
        public void DeleteVisa(int visaId)
        {
            SQL.DeleteVisa(visaId);
        }
        public VisaInfo GetVisa(int visaId)
        {
            return CBO.FillObject<VisaInfo>(SQL.GetVisa(visaId));
        }
        public List<VisaInfo> ListVisa()
        {
            return CBO.FillCollection<VisaInfo>(SQL.ListVisa());
        }
        public DataTable SelectVisa()
        {
            return CBO.ConvertToDataTable(ListVisa(), typeof(VisaInfo));
        }
         public Dictionary<object, object> ListVisaLookup()
        {
            var visas = ListVisa();
            var dicusers = new Dictionary<object, object>();
            foreach (VisaInfo info in visas)
                dicusers.Add(info.VisaId, info.VisaName);

            return dicusers;
        }
    }
}
